<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<%--批量分配页面--%>
<div class="layer-warp">

    <div class="distribPersonel popups-info" id="allotBox">
        <table class="add-table form-table">
            <tr>
                <th><span class="form-label required">分配方式：</span></th>
                <td>
                    <div class="layui-input-inline select2-inline">
                        <select class='select-style' name="allotWay" id="allotWay">
                            <option value="">请选择</option>
                            <option value="${ALLOT_TO_FLOW_USER}">分配给生产人</option>
                            <option value="${ALLOT_TO_PRODUCT_USER}">分配给负责人</option>
                            <option value="${ALLOT_TO_PRODUCT_DEPT}">分配给部门</option>
                        </select>
                    </div>
                </td>
            </tr>
            <tr>
                <th><span class="form-label required">选择分配人员：</span></th>
                <td>
                    <div class="layui-input-inline select2-inline"v id="flowUserIdDiv">
                        <select id="flowUserId" name="flowUserId" class="flowUserId" style="width: 240px;">
                            <option value>请选择</option>
                        </select>
                    </div>
                </td>
            </tr>
            <tr>
                <th><span class="form-label required">合同开始时间：</span></th>
                <td>
                    <div class="layui-inline">
                        <input type="text" name="contractStartTime" placeholder="开始时间" class="Wdate input-style" id="d4313"
                               onFocus="WdatePicker({onpicked:function(){d4314.focus();}, maxDate:'#F{ $dp.$D(\'d4314\')}', dateFmt:'yyyy-MM-dd'})">
                    </div>
                </td>
            </tr>
            <tr>
                <th><span class="form-label required">合同结束时间：</span></th>
                <td>
                    <div class="layui-inline">
                        <input type="text" name="contractEndTime" placeholder="结束时间" class="Wdate input-style" id="d4314"
                               onFocus="WdatePicker({minDate:'#F{$dp.$D(\'d4313\')}', dateFmt:'yyyy-MM-dd'})">
                    </div>
                </td>
            </tr>
            <tr>
                <th><span class="form-label">选择协单人员：</span></th>
                <td>
                    <div class="layui-input-inline select2-inline">
                        <select id="assistId" name="assistId" class="assistId">
                        </select>
                    </div>
                </td>
            </tr>
            <tr>
                <th><span class="form-label">是否需办理：</span></th>
                <td>
                    <div class="layui-input-inline select2-inline">
                        <input type="radio" name="isNeedDispose" value="0" checked/>需要办理&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="radio" name="isNeedDispose" value="1"/>无需办理
                    </div>
                </td>
            </tr>
            <tr>
                <th><span class="form-label">备注：</span></th>
                <td>
                    <textarea class="textarea-style" rows="4" name="lastRemark" id="lastRemark" placeholder="500字以内123"></textarea>
                </td>
            </tr>
        </table>
    </div>
</div>
<script src="${rootUrl}/static/js/zzsc/common/sc_chooseUser.js?v=${version}" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    $(function () {
        $(document).ready(function () {
            areaLength($('#lastRemark'),500);
            $("#allotWay").change(function () {
                $("#flowUserIdDiv").html("").append("<select style=\"width: 240px;\"  id=\"flowUserId\" name=\"flowUserId\" class = \"flowUserId\">" +
                    "                            <option value>请选择</option>" +
                    "                        </select>");
                var allotWay = $("#allotWay").val();
                if(allotWay=="SC_GENERAL_ALLOT03"){
                    //初始化分配人员选择
                    chooseUserPlug.init($('.flowUserId'),{
                        url:sysInfo.basePath+'/zzsc/common/find_user_choose.do',
                        width:'240px',
                        // multiple:true,// 单选false或不写该参数，多选true
                        otherParam:{
                            roleName:'ZZSC_HTMANAGER',
                            //type:'role',
                            locked:'0',
                            organId:'${productOrgId}'//查询订单生产所属事业部下的角色人员
                        }
                    });
                }else{
                    //初始化分配人员选择
                    chooseUserPlug.init($('.flowUserId'),{
                        url:sysInfo.basePath+'/zzsc/common/find_user_choose.do',
                        width:'240px',
                        // multiple:true,// 单选false或不写该参数，多选true
                        otherParam:{
                            //type:'division',
                            organId:'${productOrgId}',//查询订单生产所属事业部下的角色人员
                            locked:'0'
                        }
                    });
                }
            });
        });
       /* //初始化分配人员选择
        chooseUserPlug.init($('.flowUserId'), {
            url: sysInfo.basePath + '/zzsc/common/find_user_choose.do',
            width: '240px',
            // multiple:true,// 单选false或不写该参数，多选true
            otherParam: {
                /!**
                 * type: 用户信息选择类型（必填）
                 *       all:全部用户，division：当前登录人所在事业部，department:当前登录人所在部门及以下，role: 查询指定角色用户，
                 * roleCode : 角色Code，（type为role时，必填）
                 * locked: 用户状态，（选填，默认全部状态）
                 *      0、正常；1、锁定；2、离职
                 *!/
                type: 'division',
                locked: '0'
            }
        });*/
        //初始化协单人员  如果有回显
        chooseUserPlug.init($('.assistId'), {
            width: '240px',
            url: sysInfo.basePath + '/zzsc/common/find_user_choose.do',
            multiple: true,// 单选false或不写该参数，多选true
            allowClear: false,
            otherParam: {
                /**
                 * type: 用户信息选择类型（必填）
                 *       all:全部用户，division：当前登录人所在事业部，department:当前登录人所在部门及以下，role: 查询指定角色用户，
                 * roleCode : 角色Code，（type为role时，必填）
                 * locked: 用户状态，（选填，默认全部状态）
                 *      0、正常；1、锁定；2、离职
                 */
               // type: 'division',
                organId:'${productOrgId}',//查询订单生产所属事业部下的角色人员
                locked:0
            }
        });
        var ids = '${ids}';
        var idStr = ids.split(",");
        $("#assistId").val(idStr).trigger("change");
    });
</script>